Contents

from utils import *
import geopandas as gpd
import shapely
import cartopy.crs as ccrs
import hvplot.xarray
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 5
      3 import shapely
      4 import cartopy.crs as ccrs
----> 5 import hvplot.xarray

ModuleNotFoundError: No module named 'hvplot'
# Load file with country details
with open('data/countries.json') as fp:
    country_list = json.load(fp)
# Retrieve coordinates of selected country and calculate bounding box to subset the dataset later on
coords, full_geojson = get_boundaries({'country': 'Greece'}, country_list)
bounding_box = calculate_bounding_box(coords)
Coordinates retrieved for {'country': 'Greece'} (ADM0) - https://www.geoboundaries.org/api/current/gbOpen/GRC/ADM0/
# Load SPEI dataset for all years for the selected region and mask invalid values
spei = get_spei_dataset('1', years=list(range(1940, 2024)), bounds=bounding_box)
spei = mask_invalid_values(spei, 'SPEI1')
# Use hvplot to plot xarray dataset
spei.hvplot(
    groupby="time",
    clim=(-8,8),
    widget_type="scrubber", 
    widget_location="bottom", 
    projection=ccrs.PlateCarree(), 
    coastline='10m',
    # cnorm='eq_hist',
    cmap='BrBG',
    features=['borders']
)